﻿@*列表页模板*@
@{
    Layout = null;
    var nodeService = new NodeService();
    var siteId =int.Parse(Request.RequestContext.RouteData.Values["pageid"].ToString());//获取分页的数字
    var CurrentDepth = 1; //当前层数
    var maxDepth = nodeService.GetMany(n => n.SiteId == siteId)
                         .OrderByDescending(n => n.Depth)
                         .FirstOrDefault()
                         .Depth; //当前站点最大层数 author:郑利
    var Depth = maxDepth+1; //当前站点实际层级
    var siteServer = new SiteService().GetEntity(siteId);
    var childNodes = nodeService.GetMany(n=> n.SiteId == siteId && n.Depth ==0).OrderBy(n => n.Left);
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@siteServer.SiteTitle</title>
    <style>
        /*预置全局样式*/
        body,div,ul,li,h1,a{background:transparent;font-size:100%;margin:0;padding:0;border:0;outline:0;}
        body{color:#222;font-size:14px;line-height:1.42857143;font-family:"Microsoft YaHei"}
        a{color:#222;text-decoration:none;}
        a:hover{color:red;}
        ol,ul{list-style:none;vertical-align:middle;}
        .check-list{width: 980px; margin:50px auto;}
        .hd{ margin-bottom:20px;}
        h1.title{ font-size:30px; line-height:1.75; text-align:center;}
        .bd{ margin-bottom:20px; overflow:hidden;}
        .menu-list ul ul{ margin-left:20px;}
        .menu-list ul li{ margin-bottom:2px; padding:5px 0 5px 15px; border-left:3px solid #f5f5f5; transition:all 0.25s ease 0s; overflow:hidden; }
        .menu-list ul li a{ line-height:20px;}
        .menu-list ul li span{margin-left: 10px; color:#999;}
        .menu-list .th .title{ padding:0 15px; line-height:40px; font-size:18px; font-weight:bold; background-color:#f5f5f5; margin-bottom:10px;}
        .fd{ clear:both; border-top:1px solid #ddd; padding:20px 0; text-align:center;}
    </style>
</head>
<body>

    <div class="check-list">
        <div class="hd">
            <h1 class="title">
                @siteServer.SiteTitle 节点目录检测清单
            </h1>
        </div>
        <div class="bd">
            <div class="menu-list">
                <div class="th"><div class="title">节点目录</div></div>
                <ul>
                    <li class="li1" id="li-home">
                        <h3 class="h1">
                            <a class="a1" href="@Power.Url.SiteUrl(siteServer.Subdomain)">网站首页</a>
                        </h3>
                    </li>
                    @foreach (var childnode in childNodes.Where(n=>n.NodeStatus ==NodeStatus.Open))
                    {
                        var childCount=(childnode.Right - childnode.Left -1)/2; //获取子栏目总数
                        int subDepth=childnode.Depth+1;//子栏目层级
                        string nodeUrl;
                        if (childnode.NodeType == NodeType.Link)
                        {
                            if(childnode.LinkUrl.StartsWith("http")){
                                nodeUrl = childnode.LinkUrl;
                            }
                            else if(childnode.LinkUrl.StartsWith("{Site")){
                                nodeUrl = Power.Url.NodeUrl(childnode);
                            }
                            else{
                                nodeUrl = Power.Url.SiteUrl(siteServer.Subdomain) + childnode.LinkUrl;;
                            }
                        }
                        else
                        {
                            nodeUrl = Power.Url.SiteUrl(siteServer.Subdomain) + Power.Url.NodeUrl(childnode);
                        }
                        <li >
                            <a class="a@(subDepth)" href="@nodeUrl" target="_blank">@childnode.NodeName</a><span>@nodeUrl</span>
                                @if (childCount > 0 && subDepth < Depth)
                                {
                                    <ul>
                                        @Power.Partial("SiteCheck","验收清单多级节点", new { NodeIdentifier = childnode.Identifier, Depth, siteId=siteId, siteIndentifier=siteServer.Subdomain, left=childnode.Left, right=childnode.Right, CurrentDepth = subDepth })
                                    </ul>
                                }
                        </li>
                    }
                </ul>
            </div>
        </div>
    </div>
</body>
</html>